<div class='dashboard'>
    <row v-if="isEnableCustomized">
      <app-build @handleClick="handleClick.apply(_self, arguments)"></app-build>
    </row>
    <row v-if="!isHasCustomized">
<#--  BEGIN：看板Flex布局-前  -->
<#if ctrl.getLayoutMode?? && ctrl.getLayoutMode() == 'FLEX'>
    <div style = 'display : flex; <#if ctrl.getFlexAlign()??> justify-content :${ctrl.getFlexAlign()};</#if> <#if ctrl.getFlexDir()??> flex-direction:${ctrl.getFlexDir()};</#if> <#if ctrl.getFlexVAlign()??>align-items:${ctrl.getFlexVAlign()};</#if> '>
</#if>
<#--  END：看板Flex布局-前  -->
<#list ctrl.getPSPortlets() as portlet><#t>
  <#if portlet.getPortletType?? && portlet.getPortletType()??><#t>
    <#--  BEGIN：获取父的layout，自己的LayoutPos  -->
    <#assign layout=ctrl.getLayoutMode()>
    <#assign LayoutPos = portlet.getPSLayoutPos()>
    <#--  END：获取父的layout，自己的LayoutPos  -->
    <#--  BEGIN：门户部件绘制，栅格布局  -->
    <#if layout == 'TABLE_12COL'>
      <#assign multiple = 2/>
    <#else>
      <#assign multiple = 1/>
    </#if>
    <#macro format_numer num>
      <#if num lt 0 >
        0<#t>
      <#elseif num gt 24>
        24<#t>
      <#else>
        ${num}<#t>
      </#if>
    </#macro>
    <#if (layout == 'TABLE_24COL' || layout == 'TABLE_12COL') && LayoutPos??><#t>
      <i-col<#if LayoutPos.getColXS() != -1> :xs="{ span: <@format_numer LayoutPos.getColXS()*multiple/>, offset: <#if LayoutPos.getColXSOffset() != -1><@format_numer LayoutPos.getColXSOffset()*multiple /><#else>0</#if> }"</#if><#if LayoutPos.getColSM() != -1> :sm="{ span: <@format_numer LayoutPos.getColSM()*multiple />, offset: <#if LayoutPos.getColSMOffset() != -1><@format_numer LayoutPos.getColSMOffset()*multiple /><#else>0</#if> }"</#if><#if LayoutPos.getColMD() != -1> :md="{ span: <@format_numer LayoutPos.getColMD()*multiple />, offset: <#if LayoutPos.getColMDOffset() != -1><@format_numer LayoutPos.getColMDOffset()*multiple /><#else>0</#if> }"</#if><#if LayoutPos.getColLG() != -1> :lg="{ span: <@format_numer LayoutPos.getColLG()*multiple />, offset: <#if LayoutPos.getColLGOffset() != -1><@format_numer LayoutPos.getColLGOffset()*multiple /><#else>0</#if> }"</#if>>
        <card class="portlet-card" :bordered="false" dis-hover :padding="0">
          <#if portlet.getPortletType() == 'CONTAINER' && portlet.isShowTitleBar() && portlet.getTitle()?has_content>
          <p slot='title'>
            ${portlet.getTitle()}
            <span class="line"></span>
          </p>
          <a slot='extra'></a>
          </#if> 
          <span>
            <@ibizindent blank=10><#t>
            ${P.getCtrlCode(portlet, 'CONTROL.html').code}
            </@ibizindent>
          </span>
        </card>
      </i-col>
    <#--  ELSE：门户部件绘制，Flex  -->
    <#else>
      <card class="portlet-card" :bordered="false" dis-hover :padding="0">
        <#if portlet.getPortletType() == 'CONTAINER' && portlet.isShowTitleBar() && portlet.getTitle()?has_content>
        <p slot='title'>
          ${portlet.getTitle()}
          <span class="line"></span>
        </p>
        <a slot='extra'></a>
        </#if> 
        <span>
          <@ibizindent blank=10><#t>
          ${P.getCtrlCode(portlet, 'CONTROL.html').code}
          </@ibizindent>
        </span>
      </card>
    </#if>
    <#--  END：门户部件绘制  -->
  </#if>
</#list>
    <#--  BEGIN：看板Flex布局-后  -->
    <#if ctrl.getLayoutMode?? && ctrl.getLayoutMode() == 'FLEX'>
    </div>
    </#if>
    <#--  END：看板Flex布局-后  -->
    </row>
    <row v-if="isHasCustomized" style="width: 100%;min-height: calc(100% - 40px);">
      <div class="portlet-container" style="position: relative;width:100%;">
        <template v-for="(item, index) of modelDta">
        <#noparse><div :key="index" :style="{zIndex: 10, position: 'absolute', height: item.h*layoutRowH + 'px', width: `calc(100% / ${layoutColNum} * ${item.w})`,top: item.y*layoutRowH + 'px', left: `calc(100% / ${layoutColNum} * ${item.x})`}"></#noparse>
          <component :key="$util.createUUID()" :is="item.componentName" :name="item.portletCodeName" :context="JSON.parse(JSON.stringify(context))" :viewDefaultUsage="false" :isAdaptiveSize="true" :viewState="viewState"></component>
        </div>
        </template>
    </div>
    </row>
</div>